package com.yanqu.road.server.logic.activity.condition.tonbing;

import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.entity.event.EventTriggerArgs;
import com.yanqu.road.entity.event.IEventListener;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.task.TaskModule;
import com.yanqu.road.server.manger.activity.tonbing.TonBingMgr;
import com.yanqu.road.utils.string.StringUtils;

/**
 * 触发赚速变化
 */
public class TonBingEarnSpeedEvent implements IEventListener {

    private GamePlayer player;

    public TonBingEarnSpeedEvent(GamePlayer player) {
        this.player = player;
    }

    @Override
    public void triggerEvent(EventTriggerArgs eventArgs) {
        if (!StringUtils.isNullOrEmpty(player.getUserInfo().getUnionUid())) {
            TonBingMgr.addUnionEarnSpeedChange(player.getUserId());
        }
    }

    public void addTrigger() {
        player.getModule(TaskModule.class).getGameEvent().addListener(eGamePlayerEventType.EarnSpeed.getValue(), this);
    }

}
